load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@com_github_grpc_grpc//bazel:generate_cc.bzl", "generate_cc")
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
    name = "posix_proto",
    srcs = [
        "bus_service.proto",
        "common.proto",
        "core_service.proto",
        "data_service.proto",
        "lease_service.proto",
        "message.proto",
        "resource.proto",
        "runtime_rpc.proto",
        "runtime_service.proto",
    ],
)

cc_proto_library(
    name = "posix_cc_proto",
    visibility = ["//visibility:public"],
    deps = [":posix_proto"],
)

cc_grpc_library(
    name = "posix_cc_grpc",
    srcs = [":posix_proto"],
    grpc_only = True,
    visibility = ["//visibility:public"],
    deps = [":posix_cc_proto"],
)

cc_library(
    name = "posix_cc_grpc_hdrs",
    hdrs = glob([
        "*.h",
    ]),
    visibility = ["//visibility:public"],
    deps = [
        "posix_cc_grpc",
    ],
)

generate_cc(
    name = "posix_cc_grpc_proto",
    srcs = [":posix_proto"],
    plugin = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin",
    visibility = ["//visibility:public"],
    well_known_protos = False,
)
